package ldh.im.fxbase.data.pojo;

import io.netty.util.internal.StringUtil;
import ldh.im.fxbase.data.pojo.status.ImDepartmentStatus;

import java.util.Arrays;
import java.util.Date;
import java.util.Set;
import java.util.stream.Collectors;

public class ImDepartment {

    private Long id;
    private String currentUserId;
    private String code;
    private String name;
    private String description;
    private String parentCode;
    private String managerUserId;
    private Set<String> otherManagerUserIdSet;
    private String otherManagerUserIds;
    private ImDepartmentStatus status;
    private Date createDateTime;
    private Date updateDateTime;
    private String ext1;
    private String ext2;

    private Set<ImUser> imUserSet;                   // 部门下的人员
    private Set<ImDepartment> childrenSet;       // 子属机构

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getParentCode() {
        return parentCode;
    }

    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }

    public String getManagerUserId() {
        return managerUserId;
    }

    public void setManagerUserId(String managerUserId) {
        this.managerUserId = managerUserId;
    }

    public ImDepartmentStatus getStatus() {
        return status;
    }

    public void setStatus(ImDepartmentStatus status) {
        this.status = status;
    }

    public Date getCreateDateTime() {
        return createDateTime;
    }

    public void setCreateDateTime(Date createDateTime) {
        this.createDateTime = createDateTime;
    }

    public Date getUpdateDateTime() {
        return updateDateTime;
    }

    public void setUpdateDateTime(Date updateDateTime) {
        this.updateDateTime = updateDateTime;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    public Set<ImUser> getImUserSet() {
        return imUserSet;
    }

    public void setImUserSet(Set<ImUser> imUserSet) {
        this.imUserSet = imUserSet;
    }

    public Set<ImDepartment> getChildrenSet() {
        return childrenSet;
    }

    public void setChildrenSet(Set<ImDepartment> childrenSet) {
        this.childrenSet = childrenSet;
    }

    public String getOtherManagerUserIds() {
        return otherManagerUserIds;
    }

    public void setOtherManagerUserIds(String otherManagerUserStr) {
        this.otherManagerUserIds = otherManagerUserStr;
        if (StringUtil.isNullOrEmpty(otherManagerUserStr)) {
            this.otherManagerUserIdSet = Arrays.stream(otherManagerUserStr.split(",")).collect(Collectors.toSet());
        }
    }

    public Set<String> getOtherManagerUserIdSet() {
        return otherManagerUserIdSet;
    }

    public void setOtherManagerUserIdSet(Set<String> otherManagerUserIdSet) {
        this.otherManagerUserIdSet = otherManagerUserIdSet;
    }

    public String getCurrentUserId() {
        return currentUserId;
    }

    public void setCurrentUserId(String currentUserId) {
        this.currentUserId = currentUserId;
    }
}
